package com.datastructure.test.deleterepeatelementinarray;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class DeleteRepeatElementInArray {

    public static void main(String[] args) {

    }

    public int[] deleteRepeatElementInArray(int[] array){
        int [] data = null;
        Set<Integer> set = new HashSet<>();
        int index = 0;
        for (int i = 0; i < array.length-1; i++) {
            set.add(array[i]);
        }
        data=new int[set.size()];
        for (Integer integer : set) {
            data[index++] = integer;
        }
        return data;
    }
}
